<template>
  <div class="view-container workOvertimeList">
    <header class="view-header">
      <div class="header-container">
        <div class="header-title">
          <i class="el-icon-s-grid"></i>
          <span>请假审批</span>
        </div>
        <div class="header-form">
          <!--更多-->
<!--          <div class="header-form-item">
            <el-dropdown @command="handleCommand">
              <el-button type="default" :loading="delLoading">
                更多<i class="el-icon-arrow-down el-icon&#45;&#45;right"></i>
              </el-button>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item icon="el-icon-refresh-right" class="color-refresh-item" command="refresh">刷新
                </el-dropdown-item>
                <el-dropdown-item icon="el-icon-edit" class="color-edit-item" command="edit">编辑</el-dropdown-item>
                <el-dropdown-item icon="el-icon-delete" class="color-del-item" command="del">{{isBatchesDel}}
                </el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
          </div>-->
          <!--搜索-->
<!--          <div class="header-form-item">
            <el-button type="primary" icon="el-icon-search" @click="fetchData">查询</el-button>
          </div>-->
<!--          <div class="header-form-item">
            <el-button type="success" icon="el-icon-s-check" @click="doApproval">审批</el-button>
          </div>-->
        </div>
      </div>
    </header>

    <section>
      <el-table
        ref="table"
        :data="tableData"
        border
        stripe
        @selection-change="handleSelectionChange"
        @row-click="handleRowClick"
      >
        <el-table-column type="selection" align="center"/>
        <el-table-column prop="qingJiaRenName" label="请假人" align="center" width="100" />
        <el-table-column prop="qjyy" label="请假原因" align="left" >
          <template slot-scope="s">
            <el-link @click="showDetail(s.row.qingJiaId)">{{s.row.qjyy}}</el-link>
          </template>
        </el-table-column>
        <el-table-column sortable prop="qjtype" label="请假类型" align="center" width="110"/>
        <el-table-column sortable prop="qjstime" label="开始时间" :formatter="qjstimeFmt" width="150" align="center"/>
        <el-table-column sortable prop="qjetime" label="结束时间" :formatter="qjetimeFmt" width="150" align="center"/>
        <el-table-column label="操作" align="center" width="100">
          <template slot-scope="s">
<!--            <el-tag :type="switchType(s.row.stateName)">{{s.row.stateName}}</el-tag>-->
            <el-link @click="showDetail(s.row.qingJiaId)">审批</el-link>
          </template>
        </el-table-column>
      </el-table>
    </section>
    <footer>
      <el-pagination
        :page-sizes="[10, 20, 50, 100]"
        layout="total, sizes, prev, pager, next, jumper"
        :total="page.total"
        :page-size="page.size"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
      />
    </footer>
  </div>
</template>

<script>
  import qingJiaAPI from '@/api/qingJia/qingJia'
  import listMixin from '@/mixin/listMixin'
  export default {
    name: 'JiaBanApprovalList',
    mixins:[listMixin],
    data() {
      return {
      }
    },
    created() {
    },
    computed: {
    },
    methods: {
      showDetail(id){
        this.$router.push('/work-qingjia/approval-detail/'+id+'/'+true)
      },
      fetchData() {
        qingJiaAPI.auditList(this.page).then(res => {
          console.log('qingJiaAPI.auditList',res)
          this.tableData = res.records
          this.page.total = res.total
        })
      },
      qjstimeFmt(row){
        return this._util.format(row.qjstime)
      },
      qjetimeFmt(row){
        return this._util.format(row.qjetime)
      },
    }
  }
</script>

<style lang="scss">
</style>

